package com.aolong.archives.core.sysmanage.action;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts2.ServletActionContext;

import com.aolong.archives.core.sysmanage.service.ILoginService;
import com.rock.platform.action.BaseAction;
import com.rock.platform.util.ActionJsonResult;

public class LoginAction extends BaseAction {

	private static final long serialVersionUID = 1L;

	private ILoginService serviceLogin;
	
	public String loginSuccess() throws Exception
	{
		return SUCCESS;
	}
	
	public String login() throws Exception
	{
		try
		{
			HttpServletRequest request = ServletActionContext.getRequest();
						
			this.serviceLogin.login(request);
			
			this.setJsonString(ActionJsonResult.getSuccessResult());
		}
		catch(Exception ex)
		{
			this.setJsonString(ActionJsonResult.getErrorResult(ex.getMessage()));
		}
		return SUCCESS;
	}
	
	public ILoginService getServiceLogin() {
		return serviceLogin;
	}
	public void setServiceLogin(ILoginService serviceLogin) {
		this.serviceLogin = serviceLogin;
	}
}
